import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
class Solution1833 {
    public static void main(String[] args) {
        Map<Integer , String> map  = new HashMap<>() ;

    }
    public int maxIceCream(int[] costs, int coins) {

        int count = 0 ;
        PriorityQueue<Integer>  queue = new PriorityQueue<>() ;
        for(int i : costs){
            queue.add(i) ;
        }

        while(!queue.isEmpty() && queue.peek() <= coins){
            count ++ ;
            coins -= queue.poll() ;
        }
        return count ;
    }
}